using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text;
using System.Data; 
using yq.IBase; 
using yq.Dictionary; 
using yq.Basis; 
using yq.Model.Logic;
using System.Collections; 
using Db; 
using System.Data.Common;

namespace yq.Model.Base 
{
    ///<summary>
    /// Article_Content - 最近新鲜事 - 对象基础类
    /// </summary>
    ///<typeparam name="T"></typeparam>
    public abstract class IArticleContent<T> :ModelBase<ArticleContent> where T : ArticleContent, new()
    {
        /// <summary>
        /// 写入主键值
        /// </summary>
        /// <param name="Id">主键</param>
        protected internal override void SetKeyValue(dynamic Id)
        {
            this.ContentId = Id;
        }

        /// <summary>
        /// 获取主键值
        /// </summary>
        /// <returns></returns>
        protected internal override dynamic GetKeyValue()
        {
            return ContentId;
        }

        /// <summary>
        /// 为本对象赋值
        /// </summary>
        /// <param name="dy"></param>
        public override void SetValue(dynamic dy) 
        {
           this.ContentId=dy.ContentId;
           this.UserId=dy.UserId;
           this.ModelsId=dy.ModelsId;
           this.Title=dy.Title;
           this.Type=dy.Type;
           this.KeyWords=dy.KeyWords;
           this.Summary=dy.Summary;
           this.Click=dy.Click;
           this.IsComment=dy.IsComment;
           this.IsImage=dy.IsImage;
           this.SubmitTime=dy.SubmitTime;
           this.CommentNum=dy.CommentNum;
           this.EditTime=dy.EditTime;
           this.Sno=dy.Sno;
           this.IsClose=dy.IsClose;
           this.Version=dy.Version;
        } 

        #region 定义属性

     
         /// <summary>
        /// 流水ID
        /// </summary>
        private String _ContentId = "";
      
        /// <summary>
        /// 流水ID
        /// </summary>
        public String ContentId
        {
            get 
            {
              return   (this._ContentId); 
            }

            set 
            {
                    _ContentId= value;  
            }
        }
       
     
         /// <summary>
        /// 发布人ID
        /// </summary>
        private String _UserId = "";
      
        /// <summary>
        /// 发布人ID
        /// </summary>
        public String UserId
        {
            get 
            {
              return   (this._UserId); 
            }

            set 
            {
                    _UserId= value;  
            }
        }
       
     
         /// <summary>
        /// 关联ID
        /// </summary>
        private String _ModelsId = "";
      
        /// <summary>
        /// 关联ID
        /// </summary>
        public String ModelsId
        {
            get 
            {
              return   (this._ModelsId); 
            }

            set 
            {
                    _ModelsId= value;  
            }
        }
       
     
         /// <summary>
        /// 标题
        /// </summary>
        private String _Title = "";
      
        /// <summary>
        /// 标题
        /// </summary>
        public String Title
        {
            get 
            {
              return   (this._Title); 
            }

            set 
            {
                    _Title= value;  
            }
        }
       
     
         /// <summary>
        /// 模版类别
        /// </summary>
        private int _Type =-1;
      
        /// <summary>
        /// 模版类别
        /// </summary>
        public yq.Enums.ArticleContent.Type Type
        {
            get 
            {
              return   (yq.Enums.ArticleContent.Type)this._Type;  
            }

            set 
            {
                    _Type= value.GetHashCode(); 
            }
        }
       
     
         /// <summary>
        /// 关键字
        /// </summary>
        private String _KeyWords = "";
      
        /// <summary>
        /// 关键字
        /// </summary>
        public String KeyWords
        {
            get 
            {
              return   (this._KeyWords); 
            }

            set 
            {
                    _KeyWords= value;  
            }
        }
       
     
         /// <summary>
        /// 摘要
        /// </summary>
        private String _Summary = "";
      
        /// <summary>
        /// 摘要
        /// </summary>
        public String Summary
        {
            get 
            {
              return   (this._Summary); 
            }

            set 
            {
                    _Summary= value;  
            }
        }
       
     
         /// <summary>
        /// 点击率
        /// </summary>
        private int _Click =int.MinValue;
      
        /// <summary>
        /// 点击率
        /// </summary>
        public int Click
        {
            get 
            {
              return   (this._Click); 
            }

            set 
            {
                    _Click= value;  
            }
        }
       
     
         /// <summary>
        /// 是否开启评论
        /// </summary>
        private int _IsComment =-1;
      
        /// <summary>
        /// 是否开启评论
        /// </summary>
        public yq.Enums.BooleanType IsComment
        {
            get 
            {
              return  (yq.Enums.BooleanType)_IsComment; 
            }

            set 
            {
                    _IsComment= value.GetHashCode(); 
            }
        }
       
     
         /// <summary>
        /// 是否包含图片
        /// </summary>
        private int _IsImage =-1;
      
        /// <summary>
        /// 是否包含图片
        /// </summary>
        public yq.Enums.BooleanType IsImage
        {
            get 
            {
              return  (yq.Enums.BooleanType)_IsImage; 
            }

            set 
            {
                    _IsImage= value.GetHashCode(); 
            }
        }
       
     
         /// <summary>
        /// 发布时间
        /// </summary>
        private DateTime _SubmitTime =DateTime.MinValue;
      
        /// <summary>
        /// 发布时间
        /// </summary>
        public DateTime SubmitTime
        {
            get 
            {
              return   (this._SubmitTime); 
            }

            set 
            {
                    _SubmitTime= value;  
            }
        }
       
     
         /// <summary>
        /// 评论数量
        /// </summary>
        private int _CommentNum =int.MinValue;
      
        /// <summary>
        /// 评论数量
        /// </summary>
        public int CommentNum
        {
            get 
            {
              return   (this._CommentNum); 
            }

            set 
            {
                    _CommentNum= value;  
            }
        }
       
     
         /// <summary>
        /// 修改时间
        /// </summary>
        private DateTime _EditTime =DateTime.MinValue;
      
        /// <summary>
        /// 修改时间
        /// </summary>
        public DateTime EditTime
        {
            get 
            {
              return   (this._EditTime); 
            }

            set 
            {
                    _EditTime= value;  
            }
        }
       
     
         /// <summary>
        /// 排序
        /// </summary>
        private int _Sno =int.MinValue;
      
        /// <summary>
        /// 排序
        /// </summary>
        public int Sno
        {
            get 
            {
              return   (this._Sno); 
            }

            set 
            {
                    _Sno= value;  
            }
        }
       
     
         /// <summary>
        /// 是否隐藏
        /// </summary>
        private int _IsClose =-1;
      
        /// <summary>
        /// 是否隐藏
        /// </summary>
        public yq.Enums.BooleanType IsClose
        {
            get 
            {
              return  (yq.Enums.BooleanType)_IsClose; 
            }

            set 
            {
                    _IsClose= value.GetHashCode(); 
            }
        }
       
     

      #endregion 定义属性 

          protected internal override void SetValue(ArticleContent info, DataRow row) 
          { 
               if (row == null) 
               { 
                 info.IsLoad = false; 
               }
               else 
               { 
                  info.IsLoad = true; 
                  
                  if(row["ContentId"]!= DBNull.Value)
                  {
                  info.ContentId=row["ContentId"].ToString();
                 }
                 
                  
                  if(row["UserId"]!= DBNull.Value)
                  {
                  info.UserId=row["UserId"].ToString();
                 }
                 
                  
                  if(row["ModelsId"]!= DBNull.Value)
                  {
                  info.ModelsId=row["ModelsId"].ToString();
                 }
                 
                  
                  if(row["Title"]!= DBNull.Value)
                  {
                  info.Title=row["Title"].ToString();
                 }
                 
                  
                  if(row["Type"]!= DBNull.Value)
                  {
                  info.Type=  (yq.Enums.ArticleContent.Type)(row["Type"]) ;
                 }
                 
                  
                  if(row["KeyWords"]!= DBNull.Value)
                  {
                  info.KeyWords=row["KeyWords"].ToString();
                 }
                 
                  
                  if(row["Summary"]!= DBNull.Value)
                  {
                  info.Summary=row["Summary"].ToString();
                 }
                 
                  
                  if(row["Click"]!= DBNull.Value)
                  {
                  info.Click=Convert.ToInt32(row["Click"]);
                 }
                 
                  
                  if(row["IsComment"]!= DBNull.Value)
                  {
                  info.IsComment= (yq.Enums.BooleanType)(row["IsComment"]) ;
                 }
                 
                  
                  if(row["IsImage"]!= DBNull.Value)
                  {
                  info.IsImage= (yq.Enums.BooleanType)(row["IsImage"]) ;
                 }
                 
                  
                  if(row["SubmitTime"]!= DBNull.Value)
                  {
                  info.SubmitTime=Convert.ToDateTime(row["SubmitTime"]);
                 }
                 
                  
                  if(row["CommentNum"]!= DBNull.Value)
                  {
                  info.CommentNum=Convert.ToInt32(row["CommentNum"]);
                 }
                 
                  
                  if(row["EditTime"]!= DBNull.Value)
                  {
                  info.EditTime=Convert.ToDateTime(row["EditTime"]);
                 }
                 
                  
                  if(row["Sno"]!= DBNull.Value)
                  {
                  info.Sno=Convert.ToInt32(row["Sno"]);
                 }
                 
                  
                  if(row["IsClose"]!= DBNull.Value)
                  {
                  info.IsClose= (yq.Enums.BooleanType)(row["IsClose"]) ;
                 }
                 
                  
                  if(row["Version"]!= DBNull.Value)
                  {
                  info.Version=row["Version"].ToString();
                 }
                 
               } 

          } 

        protected internal override void GetDbParameters(DbCommand comm, ArticleContent info, DbHelper cn) 
        { 
             
                cn.AddInParameter(comm, "@ContentId", DbType.String,ParameterTool.GetObj( info._ContentId )); 
            
             
                cn.AddInParameter(comm, "@UserId", DbType.String,ParameterTool.GetObj( info._UserId )); 
            
             
                cn.AddInParameter(comm, "@ModelsId", DbType.String,ParameterTool.GetObj( info._ModelsId )); 
            
             
                cn.AddInParameter(comm, "@Title", DbType.String,ParameterTool.GetObj( info._Title )); 
            
             
                cn.AddInParameter(comm, "@Type", DbType.Int32,ParameterTool.GetObj( info._Type )); 
            
             
                cn.AddInParameter(comm, "@KeyWords", DbType.String,ParameterTool.GetObj( info._KeyWords )); 
            
             
                cn.AddInParameter(comm, "@Summary", DbType.String,ParameterTool.GetObj( info._Summary )); 
            
             
                cn.AddInParameter(comm, "@Click", DbType.Int32,ParameterTool.GetObj( info._Click )); 
            
             
                cn.AddInParameter(comm, "@IsComment", DbType.Int32,ParameterTool.GetObj( info._IsComment )); 
            
             
                cn.AddInParameter(comm, "@IsImage", DbType.Int32,ParameterTool.GetObj( info._IsImage )); 
            
             
                cn.AddInParameter(comm, "@SubmitTime", DbType.DateTime,ParameterTool.GetObj( info._SubmitTime )); 
            
             
                cn.AddInParameter(comm, "@CommentNum", DbType.Int32,ParameterTool.GetObj( info._CommentNum )); 
            
             
                cn.AddInParameter(comm, "@EditTime", DbType.DateTime,ParameterTool.GetObj( info._EditTime )); 
            
             
                cn.AddInParameter(comm, "@Sno", DbType.Int32,ParameterTool.GetObj( info._Sno )); 
            
             
                cn.AddInParameter(comm, "@IsClose", DbType.Int32,ParameterTool.GetObj( info._IsClose )); 
            
                
                cn.AddInParameter(comm,"@Version", DbType.String, Guid.NewGuid().ToString());
              

                cn.AddInParameter(comm,"@_versionOdl", DbType.String, info._Version); 
                 
        } 

    } 
} 